package com.flashextended.apps.logomaker.view.windows.properties.content
{
	import com.flashextended.apps.logomaker.controlers.Controlers;
	import com.flashextended.apps.logomaker.singleton.AppLocales;
	import com.flashextended.utils.graphics.buttons.VistaSmallButton;
	
	import mx.containers.HBox;
	import mx.containers.VBox;
	import mx.controls.Label;
	import mx.core.UIComponent;

	public class GenericPropertiesContent extends HBox
	{
		
	    [Embed(source="../assets/images/go_bottom.png")]
	    private var Bottom:Class;
	    protected var goBottom:VistaSmallButton;
	    
	    [Embed(source="../assets/images/go_top.png")]
	    private var Top:Class;
	    protected var goTop:VistaSmallButton;
	    
	    [Embed(source="../assets/images/delete_object.png")]
	    private var Delete:Class;
	    protected var deleteObject:VistaSmallButton;	    	    
	    
	    private var commonMenu:VBox;
	    
		public function GenericPropertiesContent()
		{
			super();
			addCommonMenu();
		}
		
		private function settings():void
		{
			this.percentWidth = 100;
			this.percentHeight = 100;
		}		
		
		private function addCommonMenu():void
		{
			commonMenu = new VBox();
			commonMenu.percentWidth = 100;
			commonMenu.percentHeight = 100;
			commonMenu.setStyle("verticalGap", 10);
			commonMenu.setStyle("paddingLeft", 6);
			commonMenu.setStyle("paddingTop", 6);
			
			goTop = new VistaSmallButton(new Top());
			commonMenu.addChild(buildMenuLabels(goTop, AppLocales.getInstance().data.locales["moveObjectUp"]));
			Controlers.getInstance().addMouseAction(goTop, Controlers.getInstance().moveObjectUp);
			
			goBottom = new VistaSmallButton(new Bottom());
			commonMenu.addChild(buildMenuLabels(goBottom, AppLocales.getInstance().data.locales["moveObjectDown"]));
			Controlers.getInstance().addMouseAction(goBottom, Controlers.getInstance().moveObjectDown);	
			
			deleteObject = new VistaSmallButton(new Delete());
			commonMenu.addChild(buildMenuLabels(deleteObject, AppLocales.getInstance().data.locales["deleteObject"]));
			Controlers.getInstance().addMouseAction(deleteObject, Controlers.getInstance().removeObject);
			
			this.addChild(commonMenu);			
		}
		public function getCommonMenuContainer():VBox
		{
			return commonMenu;
		}
		
		protected function buildMenuLabels(btn:UIComponent, txt:String):HBox
		{
			var hb:HBox = new HBox();
			hb.percentWidth = 100;
			hb.percentHeight = 100;
			hb.addChild(btn);
			var l:Label = new Label();
			l.text = txt;
			hb.addChild(l);
			return hb;
		}
		
		public function getUpButton():VistaSmallButton
		{
			return goTop;
		}
		public function getDownButton():VistaSmallButton
		{
			return goBottom;
		}
		
	}
}